<?php

require_once '../AopClient.php';
require_once '../AopCertification.php';
require_once '../request/AlipayTradeQueryRequest.php';
require_once '../request/AlipayTradeWapPayRequest.php';
require_once '../request/AlipayMerchantOrderSyncRequest.php';
require_once '../request/AlipayMerchantItemFileUploadRequest.php';


/**
 * 证书类型AopCertClient功能方法使用测试
 * 1、execute 证书模式调用示例
 * 2、sdkExecute 证书模式调用示例
 * 3、pageExecute 证书模式调用示例
 */


//1、execute 使用
$aop = new AopClient ();

$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
$aop->appId = '2019111769162938';
//应用私钥
$aop->rsaPrivateKey = 'MIIEowIBAAKCAQEApujFlNj/OBthEfUCE7PdhiyjcJNqhMmBQ7Ic0MmUlQf1cYMsZSutHMVNu87J5Z2CS6urMTxr/aETRiTSMeMRNGZ78oiyNkwM4lr2F426xkiHcI2bnSyyVElPwSFPv/QaOxnguBrZwFu8Fp4kayILbgBtg74+si106snfAOkReRqXjGT51MwpJayzwiuqsp7RqklF0w0YvuFdRPcOuHV2VQeIW8BfH60hNyMB60M5gw/hc/LVJXRrMOkcPXyGJhsEhQa2K4KAvSwW/jn3mo9x/DRC4ysFHi9uXhIioQUUa7uq4Pg8aEUIQUNbKEQsKND4xuYn1L1GVsFVtLE6aK69cwIDAQABAoIBAFkToV7u8EZhVkzfFVyugWs6J3/NLOvxHquiQv6qlkFzHeqWtvrHdHwGUJYKpnWEuiToWVTNilSxwjeNLyCwrl3o0/18NqADtlyXbv7jBOsNijrnWEVptUKGXaoUvRsUi2s/RE79BXlDe/4WKBmE8dSjJc9JmOw+lkc3tWwm9sxKKCP8wFvJj92C00vOpCC/5NMCqp6WdmDBsux4uq9ynecQ6uJMdq7zvvbmJ2lW+7H31sp7pUcxUnB3Xqq+fzK1tuEalq6KppdOYZ/5Rg780g3PoVfUanq6IqZjhetcS7FdKhqD4qbTzZvBfJ1zV5T2LN/V1j5aVHTkViQVcTlGggECgYEA06jaaxUX+zkKIwLLAu1pfKRZIPY4tkJCacST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N342oDWVtl9M0ODMSBSkL88luJ6zv0yC6YWaYSAXBW3Jk1PbjCuNWx6VJ6vuovMXPhjmvzUu7O+98VlfmMb57z6Td8k6TtRI7ToGTNgqSweWpiTz3ZCaUdFdew4rjr6xt1ddtZC5kxgNOA2X2WekHU+AAoP2gvy0GacEQ+8PKxqIbymDQIDAQAB';
$aop->apiVersion = '1.0';
$aop->signType = 'RSA2';
$aop->postCharset='utf-8';
$aop->format='json';


$request = new AlipayTradeQueryRequest ();
$request->setBizContent("{" .
    "\"out_trade_no\":\"20150320010101001\"," .
    "\"trade_no\":\"2019101122001404060523103774\"," .
    "\"org_pid\":\"2088101117952222\"," .
    "      \"query_options\":[" .
    "        \"TRADE_SETTE_INFO\"" .
    "      ]" .
    "  }");
$result = $aop->execute ( $request);
var_dump($result);



//2、sdkExecute 测试
$aop = new AopClient ();

$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
$aop->appId = '你的appid';
$aop->rsaPrivateKey = '你的应用私钥';
$aop->alipayrsaPublicKey = '你的支付宝公钥';
$aop->apiVersion = '1.0';
$aop->signType = 'RSA2';
$aop->postCharset='utf-8';
$aop->format='json';

$request = new AlipayOpenOperationOpenbizmockBizQueryRequest ();
request.setBizContent("{\"status\":\"1001\",\"shop_id\":\"2001\"}");
$result = $aop->sdkExecute($request);
echo $result;


//3、pageExecute 测试
$aop = new AopClient ();

$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
$aop->appId = '你的appid';
$aop->rsaPrivateKey = '你的应用私钥';
$aop->alipayrsaPublicKey = '你的支付宝公钥';
$aop->apiVersion = '1.0';
$aop->signType = 'RSA2';
$aop->postCharset='utf-8';
$aop->format='json';

$request = new AlipayTradeWapPayRequest ();
$request->setBizContent("{" .
    "    \"body\":\"对一笔交易的具体描述信息。如果是多种商品，请将商品描述字符串累加传给body。\"," .
    "    \"subject\":\"测试\"," .
    "    \"out_trade_no\":\"70501111111S001111119\"," .
    "    \"timeout_express\":\"90m\"," .
    "    \"total_amount\":9.00," .
    "    \"product_code\":\"QUICK_WAP_WAY\"" .
    "  }");
$result = $aop->pageExecute ( $request);
echo $result;


